package reflect;

import reflect.annotation.AutoRunClass;

import java.util.Scanner;
//reflect.Person
public class Test3 {
    public static void main(String[] args) throws Exception {
        System.out.println("请输入一个类名");
        Scanner scanner=new Scanner(System.in);
        String str = scanner.nextLine();
        Class cls = Class.forName(str);
        boolean mark = cls.isAnnotationPresent(AutoRunClass.class);
        if (mark){
            Object obj = cls.newInstance();
        }else {
            System.out.println("该类不符合条件,不可实例化");
        }
    }
}
